<template>
  <div class="model-form">
    <el-page-header @back="goBack" content="详情"></el-page-header>
    <div class="form-title">详细信息</div>
    <el-form class="viewForm" label-width="120px">
      <el-col :span="12">
        <el-form-item label="订单号">
          <div v-html="viewModel.no"></div>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="下单时间">
          <div v-html="viewModel.addDate"></div>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="实际支付金额">
          <div v-html="viewModel.payAmount"></div>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="收货人">
          <div v-html="viewModel.consignee"></div>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="联系电话">
          <div v-html="viewModel.phone"></div>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="收货地址">
          <div v-html="viewModel.address"></div>
        </el-form-item>
      </el-col>
      <el-col :span="24">
        <el-form-item label="备注">
          <div v-html="viewModel.note"></div>
        </el-form-item>
      </el-col>
    </el-form>
    <div class="form-title">订单明细</div>

    <el-table :data="viewModel.items" style="width: 100%; font-size: 12px">
      <el-table-column label="商品" prop="no" width="180">
        <template slot-scope="scope">
          <img :src="scope.row.logo" style="width: 100px; height: auto" />
          <p>{{ scope.row.name }}</p>
        </template>
      </el-table-column>
      <el-table-column label="价格(元)" prop="price" width="100"></el-table-column>
      <el-table-column label="数量" prop="amount" width="100"></el-table-column>
      <el-table-column label="小计" prop="subtotal" width="100"></el-table-column>
    </el-table>
  </div>
</template>

<script>
  import common from "@/mixins/common.js";

  export default {
    mixins: [common],
    data() {
      return {
        viewModel: {},
        activeIndex: "1",
      };
    },
    mounted() {
      var id = this.$route.query.id;
      var self = this;
      var data = {};
      data.id = id;

      var url = self.$CONFIG.REMOTE_URL + "/rest/dishorder/view.htm";
      console.info(url);
      this.$HTTP.form(url, data).then((res) => {
        if (res.code == 0) {
          self.viewModel = res;
        }
      });
    },
  };
</script>

<style>
</style>